<?php 
/**
 * TomatoCMS
 * 
 * LICENSE
 *
 * This source file is subject to the GNU GENERAL PUBLIC LICENSE Version 2 
 * that is bundled with this package in the file LICENSE.txt.
 * It is also available through the world-wide-web at this URL:
 * http://www.gnu.org/licenses/gpl-2.0.txt
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@tomatocms.com so we can send you a copy immediately.
 * 
 * @copyright	Copyright (c) 2009-2010 TIG Corporation (http://www.tig.vn)
 * @license		http://www.gnu.org/licenses/gpl-2.0.txt GNU GENERAL PUBLIC LICENSE Version 2
 * @version		$Id: category.phtml 5186 2010-08-30 12:02:46Z huuphuoc $
 * @since		2.0.0
 */
?>
<?php
$this->headTitle($this->category->name); 
?>
<style>
    .b_a_right{
        text-align: right;
    }
    .b_l_content{
        display: inline-block;
    }
    .b_l_content .b_title a{
        font-weight: bold;
        font-size: 10pt;
        color: #333366;
    }
    .b_l_content .b_post lable{
        font-weight: bold;
    }
    .b_l_content .b_content{
        text-align: justify;
        display: inline-block;
        width: 640px;
    }
    .b_l_content .b_action{
        margin: -5px 0 10px;
        padding-left: 105px;
    }
    .b_a_paginator{
        text-align: center;
    }

    .b_l_content .b_content span{
        text-transform: none;
    }
	.pageTitle{
		color: #E37A02;
		font-size: 15px;
		font-weight: bold;
		text-transform: uppercase;	
	}
</style>
<h4 class="pageTitle"><?php echo $this->category->name?></h4>
<div class="grid_8 alpha">
	<?php echo $this->widget("news","hotest",array("limit"=>2,"category_id"=>$this->category->category_id));?>
	<?php if(count($this->articles)>0): ?>
		<?php foreach ($this->articles as $index => $article) : ?>
			<div class="b_l_content">
					<div class="title">
						<a href="<?php echo $this->url($article->getProperties(), 'news_article_details'); ?>"><?php echo $article->title; ?></a>
					</div>		
					<div class="b_post">
						<label><?php echo sprintf($this->translator("article_category_posted_by"),$article->created_user_name,date($this->globalConfig('web')->datetime->format->datetime, strtotime($article->activate_date)));?></label>                					  
					</div>			
					<div class="b_content">
						<?php 
							$file = $article->image_small;
							$path = str_replace($this->APP_STATIC_SERVER,getcwd(),$file);
							$file = Tomato_Helper_Helper::checkFile($path, $file, '_small');
							$urlImage = $file?$file:null;						
						?>					
						<div style="width:17%; float:left; display:inline-block;">
								<?php if ($urlImage) : ?>		
									<a href="<?php echo $this->url($article->getProperties(), 'news_article_details'); ?>">
										<img width="100" src="<?php echo $article->image_small;?>">
									</a>
								<?php else: ?>
									<a href="<?php echo $this->url($article->getProperties(), 'news_article_details'); ?>">
										<img width="100" src="<?php echo $this->baseUrl(); ?>/skins/bizprofile/default/html/images/img.jpg">
									</a>							
								<?php endif;?>
						</div>
						<div  style="width:83%; float:left; display:inline-block">
							<div style="width:100%;"><?php echo strip_tags($article->description); ?></div>					
							<div style="float:left;">
								<a href="<?php echo $this->url($article->getProperties(), 'news_article_details'); ?>"><?php echo $this->translator('article_add_details');?></a>
							</div>
						</div>						
					</div>			
			</div>
		<?php endforeach;?>
		<div class="paginator">
			<?php echo $this->paginator()->slide($this->paginator, $this->paginatorOptions); ?>
		</div>
	<?php endif;?>
</div>
<?php if($this->page == "enterprise_connect"):?>
<script type="text/javascript">
	$(document).ready(function(){
		$(".right-sidebar-news").prepend("<a style='font-size:15px;text-transform:uppercase;text-decoration:underline;font-weight:bold;color:blue;' href='<?php echo $this->url(array('category_id'=>1),'news_article_category');?>'><?php echo $this->translator("sttnews_knowlege_ecommerce");?></a>");
	});
</script>
<?php endif;?>